package com.r2coding.controller;

import com.r2coding.entity.UsersEntity;
import com.r2coding.service.UserService;
import com.r2coding.util.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: 98k灬
 * @since: 2022/11/01
 * @email: 98k_style@sina.com
 * @公众号: 爪哇Guy灬
 **/
@RequestMapping("/user")
@RestController
public class UserController {
    @Resource
    UserService userService;

    /**
     * 登录
     *
     * @param user 用户信息
     * @return 统一响应体
     */
    @PostMapping("/login")
    public Result login(@RequestBody UsersEntity user) {
        String jwt = userService.login(user);
        return Result.ok(jwt);
    }
}
